/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package CollaborativeFilttering.Estruturas;

/**
 *
 * @author Pedro
 */
public class MusicSet implements Comparable<MusicSet>{
    private String musica;
    private String autor;
    private int ocorrencia;
    private double distancia;

    public MusicSet()
    {
     this.ocorrencia = 0;
    }
    
    public MusicSet(String musica, String autor)
    {
       this();
       this.musica =  musica.trim();
       this.autor = autor.trim();
    }

    /**
     * @return the musica
     */
    public String getMusica() {
        return musica;
    }

    /**
     * @param musica the musica to set
     */
    public void setMusica(String musica) {
        this.musica = musica;
    }

    /**
     * @return the ocorrencia
     */
    public int getOcorrencia() {
        return ocorrencia;
    }

    /**
     * @param ocorrencia the ocorrencia to set
     */
    public void setOcorrencia(int ocorrencia) {
        this.ocorrencia = ocorrencia;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof MusicSet)
            return this.getAutor().equals(((MusicSet) obj).getAutor()) && this.musica.equals(((MusicSet)obj).musica);
        else
            return false;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 47 * hash + (this.musica != null ? this.musica.hashCode() : 0);
        hash = 47 * hash + (this.getAutor() != null ? this.getAutor().hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "{Nome :" + this.musica + "  -  Autor : " + this.getAutor() + "}";
    }

    /**
     * @return the autor
     */
    public String getAutor() {
        return autor;
    }

    /**
     * @param autor the autor to set
     */
    public void setAutor(String autor) {
        this.autor = autor;
    }

    public int compareTo(MusicSet o) {
       return this.equals(o) ? 0 : 1;
    }

    /**
     * @return the distancia
     */
    public double getDistancia() {
        return distancia;
    }

    /**
     * @param distancia the distancia to set
     */
    public void setDistancia(double distancia) {
        this.distancia = distancia;
    }




}
